/* 全局样式 - 基于设计系统 */

/* 基础样式重置 */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 防止模态框弹出时页面宽度抖动 */
  overflow-y: scroll;
}

/* CSS 变量定义 */
:root {
  /* 颜色变量 */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-secondary: #64748b;
  --color-accent: #d946ef;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #0ea5e9;
  
  /* 文本颜色 */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;
  
  /* 背景颜色 */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-muted: #f1f5f9;
  --color-bg-overlay: rgba(15, 23, 42, 0.8);
  
  /* 边框颜色 */
  --color-border-primary: #e2e8f0;
  --color-border-secondary: #cbd5e1;
  --color-border-focus: #2563eb;
  
  /* 字体变量 */
  --font-sans: 'Alibaba PuHuiTi', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  
  /* 字体大小 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* 行高 */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;
  
  /* 间距 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* 圆角 */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
  
  /* 过渡 */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* 暗色主题 */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text-primary: #f8fafc;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #64748b;
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-muted: #334155;
    --color-border-primary: #334155;
    --color-border-secondary: #475569;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-muted);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-secondary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* 选择文本样式 */
::selection {
  background-color: rgba(37, 99, 235, 0.2);
  color: var(--color-text-primary);
}

/* 焦点样式 */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* 禁用状态 */
[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 隐藏元素 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 响应式图片 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 从index.css合并的字体定义 */
@font-face {
  font-family: 'Alibaba-PuHuiTi';
  src: url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/Alibaba-PuHuiTi-Regular.woff2') format('woff2'),
       url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/Alibaba-PuHuiTi-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Alibaba-PuHuiTi';
  src: url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/Alibaba-PuHuiTi-Bold.woff2') format('woff2'),
       url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/Alibaba-PuHuiTi-Bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DingTalk-JinBuTi';
  src: url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/DingTalk-JinBuTi.woff2') format('woff2'),
       url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/DingTalk-JinBuTi.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'YouSheBiaoTiHei';
  src: url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/YouSheBiaoTiHei.woff2') format('woff2'),
       url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/YouSheBiaoTiHei.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* 字体工具类 */
.font-alibaba {
  font-family: 'Alibaba-PuHuiTi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.font-dingtalk {
  font-family: 'DingTalk-JinBuTi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.font-youshe {
  font-family: 'YouSheBiaoTiHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 标题字体样式 */
.title-primary {
  font-family: 'YouSheBiaoTiHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.title-secondary {
  font-family: 'DingTalk-JinBuTi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* 正文字体样式 */
.text-body {
  font-family: 'Alibaba-PuHuiTi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  letter-spacing: 0.005em;
}

/* 特殊用途字体 */
.text-brand {
  font-family: 'DingTalk-JinBuTi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
}

.text-display {
  font-family: 'YouSheBiaoTiHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: bold;
  letter-spacing: 0.03em;
}

/* 头像上传组件样式 */
.avatar-uploader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.avatar-uploader:hover {
  border-color: #1890ff;
}

.avatar-uploader .ant-upload {
  width: 100%;
  height: 100%;
}

.avatar-uploader .ant-upload-select {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-uploader img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* 链接样式 */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

/* 按钮重置 */
button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

/* 表单元素样式 */
input, textarea, select {
  font: inherit;
  color: inherit;
}

/* 打印样式 */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a, a:visited {
    text-decoration: underline;
  }
  
  @page {
    margin: 0.5in;
  }
}

/* 动画性能优化 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --color-border-primary: #000000;
    --color-text-primary: #000000;
  }
}

/* 实用工具类 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--spacing-sm);
}

.gap-4 {
  gap: var(--spacing-md);
}

.gap-6 {
  gap: var(--spacing-lg);
}

.rounded {
  border-radius: var(--radius-md);
}

.shadow {
  box-shadow: var(--shadow-md);
}

.transition {
  transition: all var(--transition-normal);
}

/* 响应式断点 */
@media (min-width: 640px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--spacing-xl);
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 从globals.scss合并的动画 */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes scroll-left {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* 从index.css合并的动画 */
@keyframes marquee-left {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes marquee-right {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes scroll-up {
  0% {
    transform: translateY(100%);
  }
  100% {
    transform: translateY(-100%);
  }
}

@keyframes scroll-down {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

/* 工具类 */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* 从globals.scss合并的工具类 */
.fade-in {
  animation: fade-in 0.6s ease-out;
}

.slide-up {
  animation: slide-up 0.8s ease-out;
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.gradient-shift {
  animation: gradient-shift 3s ease-in-out infinite;
  background-size: 200% 200%;
}

.scroll-left {
  animation: scroll-left 20s linear infinite;
}

/* 从index.css合并的工具类 */
.marquee-left {
  animation: marquee-left 30s linear infinite;
}

.marquee-right {
  animation: marquee-right 30s linear infinite;
}

.scroll-up {
  animation: scroll-up 20s linear infinite;
}

.scroll-down {
  animation: scroll-down 20s linear infinite;
}

/* 客户logo滚动动画 */
.animate-scroll-right {
  animation: scroll-right 30s linear infinite;
}

.animate-scroll-left {
  animation: scroll-left-continuous 30s linear infinite;
}

@keyframes scroll-right {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes scroll-left-continuous {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0);
  }
}